﻿Namespace Functions

    Public Enum MetisJoinType
        LeftJoin = -1
        InnerJoin = 0
        RightJoin = 1
    End Enum

    Public Class MetisJoin
        Implements System.ComponentModel.INotifyPropertyChanged

        Protected _LeftFuncRef As MetisRefFunction
        Protected _LeftField As MetisFunctionField
        Protected _RightFuncRef As MetisRefFunction
        Protected _RightField As MetisFunctionField
        Protected _JoinType As MetisJoinType = MetisJoinType.InnerJoin
        Protected _Owner As MetisResultFunction

        Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged


        Sub New(ByVal LeftFuncRef As MetisRefFunction, ByVal LeftField As MetisFunctionField, _
                ByVal RightFuncRef As MetisRefFunction, ByVal RightField As MetisFunctionField, ByVal Owner As MetisResultFunction)
            Me._Owner = Owner
            Me._LeftFuncRef = LeftFuncRef
            Me._LeftField = LeftField
            Me._RightFuncRef = RightFuncRef
            Me._RightField = RightField
        End Sub

        Sub New(ByVal LeftFuncRef As MetisRefFunction, ByVal LeftField As MetisFunctionField, _
                ByVal RightFuncRef As MetisRefFunction, ByVal RightField As MetisFunctionField, _
                ByVal JoinType As MetisJoinType, ByVal Owner As MetisResultFunction)
            Me.New(LeftFuncRef, LeftField, RightFuncRef, RightField, Owner)
            _JoinType = JoinType
        End Sub

        Public ReadOnly Property LeftFuncRef() As MetisRefFunction
            Get
                Return _LeftFuncRef
            End Get
        End Property

        Public ReadOnly Property LeftField() As MetisFunctionField
            Get
                Return _LeftField
            End Get
        End Property

        Public ReadOnly Property RightFuncRef() As MetisRefFunction
            Get
                Return _RightFuncRef
            End Get
        End Property

        Public ReadOnly Property RightField() As MetisFunctionField
            Get
                Return _RightField
            End Get
        End Property

        Public Property JoinType() As MetisJoinType
            Get
                Return _JoinType
            End Get
            Set(ByVal value As MetisJoinType)
                _JoinType = value
                RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs("JoinType"))
            End Set
        End Property



    End Class


End Namespace

